<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../../vue.global.js"></script>
</head>

<body>
    <div id="event-handling">
        <p>{{ message }}</p>
        <button v-on:click="reverseMessage">反转 Message</button>
    </div>

    <script>
        const EventHandling = {
            data() {
                return {
                    message: 'Hello Vue.js!'
                }
            },
            methods: {
                reverseMessage(){
                    this.message = this.message.split("").reverse().join("")
                }
            },
        }

        Vue.createApp(EventHandling).mount('#event-handling')
    </script>
</body>

</html>